home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
C
/
LIB
/
UNIXLIB37B
/
!UnixLib37
/
src
/
unix
/
c
/
readv
< prev
next >
Wrap
Text File
|
1996-11-09
|
1KB
|
44 lines
/****************************************************************************
*
* $Source: /unixb/home/unixlib/source/unixlib37/src/unix/c/RCS/readv,v $
* $Date: 1996/10/30 22:04:51 $
* $Revision: 1.1 $
* $State: Rel $
* $Author: unixlib $
*
* $Log: readv,v $
* Revision 1.1 1996/10/30 22:04:51 unixlib
* Initial revision
*
***************************************************************************/
static const char rcs_id[] = "$Id: readv,v 1.1 1996/10/30 22:04:51 unixlib Rel $";
/* unix.c.readv: Written by Nick Burrett, 6 October 1996. */
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/uio.h>
/* Read data from file descriptor FD, and put the result in the
buffers described by VECTOR, which is a vector of COUNT `struct iovec's.
The buffers are filled in the order specified. */
int readv (int fd, const struct iovec *vector, size_t count)
{
int bytes;
int bytes_read, i;
/* Find the total number of bytes to be read. */
bytes = 0;
for (i = 0; i < count; ++i)
{
bytes_read = read (fd, vector[i].iov_base, vector[i].iov_len);
if (bytes_read <= 0)
return -1;
bytes += bytes_read;
}
return bytes;
}